<!-- 报录比详细介绍、调剂相关、其他 -->
<template>
	<view class="other">
		<top-page :majorList="majorList" :querySign="info"></top-page>
		
		<view class="news contents">
			<view class="column_center font16 bold center" style="margin-bottom: 14px;">
				<text class="fs17 bold">{{title}}</text>
			</view>

			<view class="setview">
					<view class="list">
						<view class="link-item" hover-class="none" v-for="(item,index) in Data" :key="index" @click="handleJump(item,index)">
							<view class="blok"></view>
							<view class="con">
								<text class="title" style="margin-bottom: 10rpx;">{{item.title}}</text>
								<text>{{item.createTime}}  <text style="margin: 0 20rpx;color: #bfbfbf;"> | 赞{{item.giveUpCount||0}} | </text> 浏览{{item.browseCount||0}}</text>
							</view>
						</view>
					</view>
					
					<view v-if="Data.length <= 0" class="null-data">
						<img  src="http://cdn.uviewui.com/uview/empty/list.png" />
					</view>
					
			</view>
		</view>
		<!-- <buoy></buoy> -->
	</view>
</template>

<script>
	import {newarticleDetails} from '@/api/toolbox.js'
	import topPage from "./top-page.vue"
	// import buoy from '@/components/buoy/buoys.vue';
	export default {
		components: {
			topPage
			// buoy
		},
		data() {
			return {
				type: '',
				pages: 1,
				iStatusBarHeight: 0,
				majorList: {}, //该专业信息
				Data: [], //文章
				title: '',
				info: {}
			}
		},
		onLoad(options) {
			this.majorList = JSON.parse(options.majorList);
			this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight + 10;
			this.type = options.type;
			if (this.type == '1') {
				this.title = '报录比详细介绍'
			}
			if (this.type == '2') {
				this.title = '调剂相关'
			}
			if (this.type == '3') {
				this.title = '其他信息'
			}
			uni.setNavigationBarTitle({
			    title: this.title		
			})
			this.info = {...options};
			//是否查看demo
			if(options.isDemo == 1){
				this.info.majorCode = '045115';
				this.info.collegeCode = '005';
				this.info.schoolCode = '10691';
			}
			// this.info = this.$store.state.systemInfo.currentChoose
			this.getInfo()
		},
		methods: {
			goback() {
				uni.navigateBack({
					delta: 1
				})
			},
			
			getInfo() {
				newarticleDetails({
					'type': this.type,
					'code': this.info.schoolCode,
					"page": this.pages,
					"pageSize": 10
				}).then(res => {
					if (this.pages == 1) {
						this.total = res.data.total;
						this.Data = res.data.list;
						return;
					}
					this.Data.push.apply(this.Data,res.data.list);
				})
			},
			
			//底部刷新
			onReachBottom() {
				if(this.Data.length >= this.total) return;
				this.pages++;
				this.getInfo();
			},
			handleJump(item, index){
				uni.setStorageSync('article', JSON.stringify(item));
				uni.navigateTo({
					url: `/pages/toolbox/chooseMajor/school/components/dynamicDetails?state=${index}`
				})
			},
		},
		
	}
</script>
<style lang="scss">	
page{
	background-color:$pageBgColor;
}
</style>
<style lang="scss" scoped>
	.other{
		padding-bottom: 20rpx;
		.contents{
			background: #ffffff;
		}
		
		.news {
			background: #ffffff;
			margin: 30rpx;
			padding: 40rpx;
			box-sizing: border-box;
			.tip {
				display: flex;
				align-items: center;
				img {
					width: 38rpx;
					height: 38rpx;
				}
				text {
					font-size: 32rpx;
					color: #2c3e50;
					margin-left: 15rpx;
				}
			}
			.link-item {
				width: 100%;
				display: flex;
				margin-top: 40rpx;
				.blok {
					display: block;
					width: 16rpx;
					height: 16rpx;
					border-radius: 50%;
					background-color: rgba(247, 221, 94, 1);
					margin: 21rpx 30rpx 20rpx 8rpx;
				}
				.con {
					flex: 1;
					display: flex;
					flex-direction: column;
					margin-top: 0;
					text {
						font-size: 28rpx;
						color: #595959;
						line-height: 45rpx;
					}
					text+text {
						font-size: 26rpx;
						color: #bfbfbf;
					}
				}
			}
			.column_center{
				text-align: center;
			}
		}
		
		.null-data{
			text-align: center;
			img{
				margin: auto
			}
		}
	}
	
</style>
